<?php
namespace app\common\validate\Subject;

use think\Validate;

// 课程的验证器
class Subject extends Validate
{
    protected $rule =   [
        'title'  => ['require'],
        'content'   => ['require'],
        'price' => ['require','regex:/(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/'],
        'cateid' => ['require']
    ];

    protected $message  =   [
        'title.require' => '课程名称必须填写',
        'content.require'     => '课程描述必须填写',
        'price.require'   => '课程价格必须填写',
        'cateid.require'  => '课程分类必须填写'  
    ];

    protected $scene = [

    ];
}
